#2: Plotting time series datalibrary(ggplot2)ggplot(poudre_flow, aes(x = Date, y = Flow)) +geom_line(color ="steelblue") +labs(title ="Monthly Mean Flow at Site 06752260",x ="Date",y ="Flow (cfs)") +theme_minimal()
# Animate with plotly library(plotly)
Warning: package 'plotly' was built under R version 4.4.3
Attaching package: 'plotly'
The following object is masked from 'package:ggplot2':
last_plot
The following object is masked from 'package:stats':
filter
The following object is masked from 'package:graphics':
layout
ggplot_obj <-ggplot(poudre_flow, aes(x = Date, y = Flow)) +geom_line(color ="steelblue") +labs(title ="Monthly Mean Flow at Site 06752260",x ="Date",y ="Flow (cfs)") +theme_minimal()ggplotly(ggplot_obj)
#3: Subseries library(feasts)
Warning: package 'feasts' was built under R version 4.4.3
Loading required package: fabletools
Warning: package 'fabletools' was built under R version 4.4.3
Attaching package: 'fabletools'
The following object is masked from 'package:yardstick':
accuracy
The following object is masked from 'package:parsnip':
null_model
The following objects are masked from 'package:infer':
generate, hypothesize
library(fabletools)library(ggplot2)gg_season(poudre_flow, Flow) +labs(title ="Seasonal Plot of Streamflow",y ="Flow (cfs)") +theme_minimal()
# In this plot, seasons are defined by the calendar months, assuming monthly seasonablity. Subseries are time series broken down by season, in this case, one for each month. The data shows a sharp increase in streamflow from April to July, likely because of increased temperatures resulting in more snowmelt and runoff. Rainfall is also typically higher during these months. In 2014, there is outlying data from August to October with a sharp increase in streamflow.
# The data is showing strong seasonal peak each year during the spring and early summer likely because of snow melt and resulting runoff. There are lows in the late summer and winter. This shows a seasonal pattern, repeating every 12 months. This also shows long-term changes in streamflow. The streamflow remains fairly consistent with slight decreases in streamflow over the years. This slight change could be a result of humans consuming water resources faster than they can be replaced, reducing overall streamflow.